package com.ljt.kotlinandmvvm.main.adapter

import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentPagerAdapter
import com.ljt.kotlinandmvvm.main.fragment.FirstFragment
import com.ljt.kotlinandmvvm.main.fragment.FoodDetailFragment
import com.ljt.kotlinandmvvm.main.fragment.MyFragment
import com.ljt.kotlinandmvvm.main.fragment.ShoppingCartFragment

/**
 * @auther :lujiantao
 * @date :2024/4/30 4:16 PM
 * @desc :主界面viewpager适配器
 */
class MainViewPagerAdapter(manager:FragmentManager):FragmentPagerAdapter(manager) {

    private val fragments = listOf(FirstFragment(),FoodDetailFragment(),ShoppingCartFragment(),MyFragment())

    override fun getCount(): Int {
        return fragments.size
    }

    override fun getItem(position: Int): Fragment {
        return fragments[position]
    }
}